package thin4ca

import scala.collection.mutable.Map

object Main03 extends Application {

  val repo = new EntityRepository
  val domain = new Domain(repo)
  val tf = new TemplateFactory("acceptance/03-list/");

  new TemplateAnalyzer(domain).runOn(tf)
  
  val author = new Entity("author", Map("name" -> "Lorenzo"))
  val book1 = new Entity("book", Map("title" -> "It Works!", 
                                    "ISBN" -> "12345", 
                                    "author" -> author))
  val book2 = new Entity("book", Map("title" -> "This is a List!", 
                                    "ISBN" -> "98765", 
                                    "author" -> author))
  
  domain.add("01", book1);
  domain.add("01", book2);
  domain.add("01", author);
  
  val rh = new RequestHandler(tf, domain);
  
  val res = rh.handleRequest("author.html", "01");
  println(res)
  
}
